from microbit import *

NRF_ADC_BASE = 0x40007000
NRF_ADC_CONFIG = NRF_ADC_BASE + 0x504

@micropython.asm_thumb
def reg_bit_clear(r0, r1):
    ldr(r2, [r0, 0])
    bic(r2, r1)
    str(r2, [r0, 0])
    
pin0.read_analog()
reg_bit_clear(NRF_ADC_CONFIG, 0x60)

while True:
    v = pin0.read_analog()
    BAT = v * 3.6 / 1024
    display.scroll('{:.1f}v'.format(BAT))